	<div class="body_content">
            <div class="position">
		<div class="left">
		    <div style="margin-bottom: 5px; margin-top: 10px;">
			<label class="h3">
			    <b>Settings</b>
			</label>
		    </div>
		</div>
		<div class="right align_right">
                    <!--input type="text" class="search_field" name="searchUser" id="searchUser" placeholder="Search"/-->
		</div>
		<div class="hr"></div>
		<div class="content">
		    <div class="akordeon" id="buttons">
			<div class="akordeon-item expanded">
			    <div class="akordeon-item-head">
				<div class="akordeon-item-head-container">
				    <div class="akordeon-heading">
					Update Record
				    </div>
				</div>
			    </div>
			    <div class="akordeon-item-body">
				<div class="akordeon-item-content">
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update Time interval in Hour</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%;">
					    <span><b>Time:</b>
						<span id="tInterval">
						    <?php
						    $db = new Database();
						    $settings = $db->query("SELECT * FROM tbsettings","row");
						if(!$settings['Time']==""){
						    echo "Current Time Interval is <b>" . $settings['Time'] . "</b> Hour's";
						}
						    ?>
						</span>
					    </span><br />
					    <input type="text" class="textfield_one" name="updateTme" id="updateTme" style="width: 300px;" placeholder=""/>
					    <br />
						<input type="button" name="updateTimeRecord" class="button" id="updateTimeRecord" value="Update Time">
					    <br /> <br />
					    
					</div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Enable / Show Dealer Reward Points</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%; margin-bottom: 20px;">
					    <input type="checkbox" name="dealerRewardPoints" <?php if($settings['enabled']=="1"){echo "checked=checked"; } ?> id="dealerRewardPoints" class="dealerRewardPoints"/> Enabled Dealer Reward Points
					    <br /><br />
					    <input type="button" class="button" name="updatedealerRewardPoints" id="updatedealerRewardPoints" value="Update"/>
					</div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update Invoice</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%;">
					    <span><b>Paste here the location of your Invoices files:</b></span><br />
					    <span id="showUpdateInvoice">
					    <?php
						if(!$settings['UpdateInvoice']==""){
						    echo "Current saved location of the Invoice files:  <b>". $settings['UpdateInvoice']. "</b>. ";
						}
					    ?>
					    </span>
					    <br />
					    <input type="text" class="textfield_one" name="updateInvoiceFiles" id="updateInvoiceFiles" style="width: 300px;" placeholder="ex. C:/Users/Diane/Desktop/Files/Invoice/"/>
					    <br />
						<input type="button" name="updateInvoiceRecord" class="button" id="updateInvoiceRecord" value="Update Invoice">
					    
					</div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update Product</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%;">
					<span><b>Paste here the location of your Product files:</b></span><br />
					<span id="showUpdateRedemption">
					<?php
					if(!$settings['UpdateProduct']==""){
					    echo "Current saved location of the Redemption files:  <b>". $settings['UpdateProduct']. "</b>. ";
					}
					?>
					</span>
					<br />
					<input type="text" class="textfield_one" name="updateProductFiles" id="updateProductFiles" style="width: 300px;" placeholder="ex. C:/Users/Diane/Desktop/Files/Product/"/>
					<br />
					    <input type="button" name="updateProductRecord" class="button" id="updateProductRecord" value="Update Product">
					
				    </div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update Reward Points</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%;">
					    <span><b>Paste here the location of your Update Reward Points files:</b></span><br />
					    <span id="showupdateRewardFiles">
					    <?php
						if(!$settings['UpdaterewardPoints']==""){
						    echo "Current saved location of the Invoice files:  <b>". $settings['UpdaterewardPoints']. "</b>. ";
						}
					    ?>
					    </span>
					    <br />
					    <input type="text" class="textfield_one" name="updateRewardFiles" id="updateRewardFiles" style="width: 300px;" placeholder="ex. C:/Users/Diane/Desktop/Files/"/>
					    <br />
						<input type="button" name="updateRewardPath" class="button" id="updateRewardPath" value="Update Reward">
					    
					</div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Export Redeem Files</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%;">
					    <span><b>Paste here the location where you want to store the created text file.:</b></span><br />
					    <span id="showRF">
					    <?php
						if(!$settings['exportRedeem']==""){
						    echo "Current saved location of the Redeemed Files:  <b>". $settings['exportRedeem']. "</b>. ";
						}
					    ?>
					    </span>
					    <br />
					    <input type="text" class="textfield_one" name="exportRedeem" id="exportRedeem" style="width: 300px;" placeholder="ex. C:/Users/Diane/Desktop/RedeemFiles/"/>
					    <br />
						<input type="button" name="exportRedeempath" class="button" id="exportRedeempath" value="Redeem Location">
					    
					</div>
				</div>
			    </div>
			</div>
			<div class="akordeon-item">
			    <div class="akordeon-item-head">
				<div class="akordeon-item-head-container">
				    <div class="akordeon-heading">
					Page Description
				    </div>
				</div>
			    </div>
			    <div class="akordeon-item-body">
				<div class="akordeon-item-content">
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update System Logo</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%; margin-bottom: 50px;">
					    <form id="imageform" method="post" enctype="multipart/form-data" action='/ajax/images/'>
						<div class="left">
						    <input type="file" name="photoimg" id="photoimg" />
						    <br /><br />
						    <div id='preview'>
						    </div>
						</div>
					    </form>
					</div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update System Name</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%; margin-bottom: 50px;">
					    <span><b>Type System Name Here:</b></span><br />
					    <?php
						$db = new Database();
						$getSettings = $db->query("SELECT * FROM tbsettings");
						foreach($getSettings as $value){
						    $Invoice = $value['UpdateInvoice'];
						    $Product = $value['UpdateProduct'];
						    $logo = $value['logo'];
						    $SystemName = $value['SystemName'];
						    $footer = $value['footer'];
						}
					    ?>
					    <input type="text" class="textfield_one" name="systemNameT" id="systemNameT" placeholder="<?php echo $SystemName; ?>"/>
					    <br />
						<input type="button" name="updateSystemName" class="button" id="updateSystemName" value="Update">
					    
					</div>
				    <div style="margin-bottom: 5px; margin-top: 10px;">
					<label class="h3">
					    <b>Update System Footer</b>
					</label>
				    </div>
				    <div class="hr"></div>
					<div style="float: left; width: 100%; margin-bottom: 50px;">
					    <span><b>Type Footer Description Here:</b></span><br />
					    <textarea class="textfield_one" style="width: 400px; height: 200px;" id="updatefooterDesc"  placeholder="<?php echo $footer; ?>"></textarea>
					    <br />
						<input type="button" name="updatefooter" class="button" id="updatefooter" value="Update">
					    
					</div>
				    
				</div>
			    </div>
			</div>
		    </div>  
		</div>
            </div>
        </div>
	<script>
	    $(document).ready(function(){
		//For Update System name
		$("#updateSystemName").live("click", function(){
		    Action = "updateSystemName";
		    systemName = $("#systemNameT").val();
		    
		    if(systemName==""){
			showNotification({
			    message: "Don't leave it blank.",
			    type: "success",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			$.post("/ajax/settings/",{Action:Action,systemName:systemName}, function(data){
			    if(data=="Record was successfully updated."){
				showNotification({
				    message: "Record was successfully updated.",
				    type: "success",
				    autoClose: true,
				    duration: 5
				});
				$("#systemNameT").val(null);
				$(".SystemName").html(systemName)
				$(".SystemName").attr("placeholder",systemName)
				
			    }
			});
		    }
		    
		});
		//For Update System Footer
		$("#updatefooter").live("click", function(){
		    Action = "updateFooter";
		    footer = $("#updatefooterDesc").val();
		    
		    if(footer==""){
			showNotification({
			    message: "Dont leave that field blank.",
			    type: "error",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			$.post("/ajax/settings/",{Action:Action,footer:footer}, function(data){
			    if(data=="Record was successfully updated."){
				showNotification({
				    message: "Record was successfully updated.",
				    type: "success",
				    autoClose: true,
				    duration: 5
				});
				$("#updatefooterDesc").val(null);
				$("#footerDb").html(footer);
				$("#updatefooterDesc").attr("placeholder",footer);
			    }
			});
		    }
		    
		});
		
		//For Update Product
		$("#updateProductRecord").live("click", function(){
		    Action = "updateProduct";
		    Product = $("#updateProductFiles").val().replace(/\\/g, '/'); // Replace (\) to (/)
		    newProduct = Product + "/"; // Add Slashes to the last
		    if (!$("#updateProductFiles").val().match(/.*(\\).*/)) {
			// contains illegal chars
			showNotification({
			    message: "Incorrect path format.",
			    type: "error",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			if(Product==""){
			    showNotification({
				message: "Dont leave that field blank.",
				type: "error",
				autoClose: true,
				duration: 5
			    });
			}else{
			    $.post("/ajax/settings/",{Action:Action,newProduct:newProduct}, function(data){
				if(data=="Record was successfully updated."){
				    showNotification({
					message: "Record was successfully updated.",
					type: "success",
					autoClose: true,
					duration: 5
				    });
				    $("#updateProductFiles").val(null);
				    $("#showUpdateRedemption").html("Current saved location of the Redemption files:  <b>"+ newProduct + "</b>. ");
				}
			    });
			}
		    }
		});
		//For Reward Points
		$("#updateRewardPath").live("click", function(){
		    Action = "updateRewardPath";
		    path = $("#updateRewardFiles").val().replace(/\\/g, '/'); // Replace (\) to (/)
		    newPath = path + "/"; // Add Slashes to the last
		    if (!$("#updateRewardFiles").val().match(/.*(\\).*/)) {
			// contains illegal chars
			showNotification({
			    message: "Incorrect path format.",
			    type: "error",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			if(path==""){
			    showNotification({
				message: "Dont leave that field blank.",
				type: "error",
				autoClose: true,
				duration: 5
			    });
			}else{
			    $.post("/ajax/settings/",{Action:Action,newPath:newPath}, function(data){
				if(data=="Record was successfully updated."){
				    showNotification({
					message: "Record was successfully updated.",
					type: "success",
					autoClose: true,
					duration: 5
				    });
				    $("#updateRewardFiles").val(null);
				    $("#showupdateRewardFiles").html("Current saved location of the Reward files:  <b>"+ newPath + "</b>. ");
				}
			    });
			}
		    }
		});
		 
		//For Update Invoice
		$("#updateInvoiceRecord").live("click", function(){
		    Action = "updateInvoice";
		    Invoice = $("#updateInvoiceFiles").val().replace(/\\/g, '/'); // Replace (\) to (/)
		    newInvoice = Invoice + "/"; // Add Slashes to the last
		    if (!$("#updateInvoiceFiles").val().match(/.*(\\).*/)) {
			// contains illegal chars
			showNotification({
			    message: "Incorrect path format.",
			    type: "error",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			if(Invoice==""){
			    showNotification({
				message: "Dont leave that field blank.",
				type: "error",
				autoClose: true,
				duration: 5
			    });
			}else{
			    $.post("/ajax/settings/",{Action:Action,newInvoice:newInvoice}, function(data){
				if(data=="Record was successfully updated."){
				    showNotification({
					message: "Record was successfully updated.",
					type: "success",
					autoClose: true,
					duration: 5
				    });
				    $("#updateInvoiceFiles").val(null);
				    $("#showUpdateInvoice").html("Current saved location of the Invoice files:  <b>"+ newInvoice + "</b>. ");
				}
			    });
			}
		    }
		});
		//For Redeem Path
		$("#exportRedeempath").live("click", function(){
		    Action = "updateRedeemFiles";
		    rFiles = $("#exportRedeem").val().replace(/\\/g, '/'); // Replace (\) to (/)
		    newrFiles = rFiles + "/"; // Add Slashes to the last
		    if (!$("#exportRedeem").val().match(/.*(\\).*/)) {
			// contains illegal chars
			showNotification({
			    message: "Incorrect path format.",
			    type: "error",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			if(rFiles==""){
			    showNotification({
				message: "Dont leave that field blank.",
				type: "error",
				autoClose: true,
				duration: 5
			    });
			}else{
			    $.post("/ajax/settings/",{Action:Action,newrFiles:newrFiles}, function(data){
				if(data=="Record was successfully updated."){
				    showNotification({
					message: "Record was successfully updated.",
					type: "success",
					autoClose: true,
					duration: 5
				    });
				    $("#exportRedeem").val(null);
				    $("#showRF").html("Current saved location of the Redeemed Files:  <b>"+ newrFiles + "</b>. ");
				}
			    });
			}
		    }
		});
		
		//for Time
		$("#updateTimeRecord").live("click", function(){
		    time = $("#updateTme").val();
		    Action = "updateTime";
		    if(time==""){
			showNotification({
			    message: "Please input time interval.",
			    type: "error",
			    autoClose: true,
			    duration: 5
			});
		    }else{
			$.post("/ajax/settings/",{Action:Action,time:time}, function(data){
			    if(data=="Not a number."){
				showNotification({
				    message: "Not a number.",
				    type: "error",
				    autoClose: true,
				    duration: 5
				});
			    }else{
				if(data=="Time was successfully updated"){
				    showNotification({
					message: "Time was successfully updated.",
					type: "success",
					autoClose: true,
					duration: 5
				    });
				    $("#updateTme").val(null);
				    $("#tInterval").html("Current Time Interval is <b>" + time + "</b> Hour's");
				}
			    }
			    
			});
			
			
		    }
		});
		
		// for enabling
		$("#updatedealerRewardPoints").live("click", function(){
		    Action = "dealerRewardPoints";
		    if($("#dealerRewardPoints").attr("checked")){
			val = "1";
			$.post("/ajax/settings/",{Action:Action,val:val}, function(data){
			    showNotification({
				message: "Dealer Reward Points is now enabled.",
				type: "success",
				autoClose: true,
				duration: 5
			    });
			});
		    }else{
			val = "0";
			$.post("/ajax/settings/",{Action:Action,val:val}, function(data){
			    showNotification({
				message: "Dealer Reward Points is now disabled.",
				type: "error",
				autoClose: true,
				duration: 5
			    });
			});
		    }
		    
		});
	    });
	</script>
<script>
   setActivNav('settings');
</script> 